<?php


namespace Xiaoguai\DesignPattern\DP016;


class Caretaker
{
    /**
     * @var Memento $caretaker
     */
    protected $memento;

    /**
     * @param Memento $memento
     */
    public function __construct(?Memento $memento = null)
    {
        $this->memento = $memento;
    }

    /**
     * @param Memento $memento
     */
    public function setMemento(Memento $memento): void
    {
        $this->memento = $memento;
    }

    /**
     * @return Memento
     */
    public function getMemento(): Memento
    {
        return $this->memento;
    }
}